package com.myw.mail.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.myw.mail.mapper.ProductStockMapper;
import com.myw.mail.domain.ProductStock;
import com.myw.mail.service.IProductStockService;

/**
 * 库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-10
 */
@Service
@Slf4j
public class ProductStockServiceImpl extends ServiceImpl<ProductStockMapper, ProductStock> implements IProductStockService
{
    @Autowired
    private ProductStockMapper productStockMapper;

    /**
     * 查询库存
     * 
     * @param id 库存主键
     * @return 库存
     */
    @Override
    public ProductStock selectProductStockById(String id)
    {
        return productStockMapper.selectProductStockById(id);
    }

    /**
     * 查询库存列表
     * 
     * @param productStock 库存
     * @return 库存
     */
    @Override
    public List<ProductStock> selectProductStockList(ProductStock productStock)
    {
        return productStockMapper.selectProductStockList(productStock);
    }

    /**
     * 新增库存
     * 
     * @param productStock 库存
     * @return 结果
     */
    @Override
    public int insertProductStock(ProductStock productStock)
    {
        productStock.setCreateTime(DateUtils.getNowDate());
        return productStockMapper.insertProductStock(productStock);
    }

    /**
     * 修改库存
     * 
     * @param productStock 库存
     * @return 结果
     */
    @Override
    public int updateProductStock(ProductStock productStock)
    {
        productStock.setUpdateTime(DateUtils.getNowDate());
        return productStockMapper.updateProductStock(productStock);
    }

    /**
     * 批量删除库存
     * 
     * @param ids 需要删除的库存主键
     * @return 结果
     */
    @Override
    public int deleteProductStockByIds(String[] ids)
    {
        return productStockMapper.deleteProductStockByIds(ids);
    }

    /**
     * 删除库存信息
     * 
     * @param id 库存主键
     * @return 结果
     */
    @Override
    public int deleteProductStockById(String id)
    {
        return productStockMapper.deleteProductStockById(id);
    }
}
